/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"5CACF10F-A477-420C-8DB6-8A0710BB6996"}
 */
function buscar(event) {
	controller.loadRecords(gproveedorprecio_to_precios_proveedor)
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"1B889C85-B53C-404C-980C-9588BE22F698"}
 */
function agregar(event) {
	if (globals.gProveedorPrecio != null)
	{
		databaseManager.setAutoSave(false)
		
		var frm 						= forms.precios_proveedor_carga_ind
		frm.controller.newRecord()
		
		frm.proveedor_id 				= globals.gProveedorPrecio
		frm.fecha 						= application.getServerTimeStamp()
		
		//frm.elements.proveedor_id.enabled 	= false
		frm.elements.cod_prov.enabled	    = true
		frm.elements.fecha.enabled	  	    = true
		frm.elements.precio.enabled		    = true
		frm.elements.producto_id.enabled	= true
		frm.elements.bonificacion.enabled	= true
		
		var $win = application.createWindow('CARGA_PRECIO',JSWindow.MODAL_DIALOG)
		$win.title = 'Carga de Precios'
		frm.controller.show($win)
	}
	else
		globals.DIALOGS.showInfoDialog('Aviso','Elija un proveedor','OK') // 23/01/2014
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"2EDE4473-D727-4FF2-930D-C9A4BF4F7483"}
 */
function cambiaPrecio(event) {
	databaseManager.setAutoSave(false)

	var frm 						= forms.precios_proveedor_carga_ind
	frm.controller.loadRecords(precio_proveedor_id)
	//frm.producto_id 				= globals.gProductoPrecio
	//frm.proveedor_id 				= proveedor_id
	frm.fecha 						= application.getServerTimeStamp()

	//frm.elements.producto_id.enabled 	= false
	frm.elements.proveedor_id.enabled	= false
	frm.elements.fecha.enabled		= true
	frm.elements.cod_prov.enabled	= true
	frm.elements.precio.enabled		= true

	var $win = application.createWindow('CARGA_PRECIO',JSWindow.MODAL_DIALOG)
	$win.title = 'Carga de Precios'
	frm.controller.show($win)
}
